package com.arpa.wms.service;

import com.arpa.core.web.Result;
import com.arpa.wms.domain.dto.GoodsDTO;
import com.arpa.wms.domain.dto.GoodsExcelDTO;
import com.arpa.wms.domain.entity.Goods;
import com.arpa.wms.domain.vo.GoodsExcelVO;
import com.arpa.wms.domain.vo.GoodsVO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qimen.api.request.ItemsSynchronizeRequest;
import com.qimen.api.request.SingleitemSynchronizeRequest;

import java.util.List;
import java.util.Map;

/**
 * @author: Allen chen
 * @Date 2020/8/12
 * @Description:
 */
public interface IGoodsService extends IService<Goods> {
    /**
     * 保存
     * @param entity
     * @return
     */
    @Override
    boolean save(Goods entity);

    /**
     * 根据code更新实体
     * @param entity
     * @return
     */
    int updateByCode(Goods entity);

    List<GoodsVO> queryByBrandCode(List<String> codes);

    List<GoodsVO> queryByCondition(GoodsDTO goodsDTO);
     /**
      *  @author: Allen chen
      *  @Date: 2020/10/12 15:06
      *  @Description: 根据code批量查询
      */
    List<GoodsVO> queryByCodes(List<String> codes);

    /**
     * 查询详情
     * @param brandDTO
     * @return
     */
    GoodsVO detailWithUnitConversion(GoodsDTO brandDTO);

    /**
     * 查询列表
     * @param brandDTO
     * @return
     */
    List<GoodsVO> queryList(GoodsDTO brandDTO);

     /**
      *  @author: Allen chen
      *  @Date: 2020/8/13 14:13
      *  @Description: 模糊查询
      */
    List<GoodsVO> query(GoodsDTO brandDTO);

    /**
     * 查询合计,包含总数
     * @param brandDTO
     * @return
     */
    GoodsVO queryListSum(GoodsDTO brandDTO);

     /**
      *  @author: Allen chen
      *  @Date: 2020/9/29 15:38
      *  @Description: 根据商品类型获取商品数量
      */
    GoodsVO count(GoodsDTO brandDTO);

    /**
     *  @author: Allen chen
     *  @Date: 2020/8/11 10:38
     *  @Description: 批量逻辑删除
     */
    int batchDelete(List<String> list);

     /**
      * 批量修改状态
      *  @author: Allen chen
      *  @Date: 2020/8/13 10:52
      *  @Description: 批量修改状态
      */
     Map<String, Object> batchUpdateStatus(List<String> codes,String status);





    /**
     * 通过code删除
     *
     * @param codes
     */
    Map<String,Object> removeByCodes(List<String> codes);

    /**
     * 模糊查询商品
     * @param keywords 商品名称、编码、条码
     * @param shipmentCode 货主code
     */
    List<Map<String,Object>> search(String keywords, String shipmentCode);

    Map<String, Object> makeGoods(String code);

     /**
      *  @author: Allen chen
      *  @Date: 2020/11/23 9:51
      *  @Description:商品导入预览
      * @return
      */
    List<GoodsExcelVO> goodsExcelView(List<GoodsExcelDTO> list);
     /**
      *  @author: Allen chen
      *  @Date: 2020/11/23 14:09
      *  @Description: 商品导入
      */
    Result importGoods(String importCode);

    /**
     * 根据货主、商品编码获取商品信息
     * @param shipmentCode
     * @param goodCode
     * @return
     */
    Goods getByShipmentAndGoodCode(String shipmentCode, String goodCode);

    int countByTypeCode(String typeCode);

    /**
     * 导入时，根据操作类型判断是插入还是更新
     *
     * @param request
     * @param shipmentName
     */
    void batchGoodsSaveOrUpdate(ItemsSynchronizeRequest request, String shipmentName, Map<String,String> unitMap);

    /**
     * 单个商品同步时，根据操作类型判断是插入还是更新
     *
     * @param request
     * @param shipmentName
     */
    void singleGoodsSaveOrUpdate(SingleitemSynchronizeRequest request, String shipmentName, Map<String,String> unitMap);

    /**
     * 模糊查询商品
     * @param goodCode 商品编码
     * @param goodsName 商品名称
     */
    List<Map<String,Object>> searchByGoodCodeAndName(String goodCode, String goodsName,String groupCode,List<String> shipmentCodes);


}
